package com.ruoyi.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * 读取项目相关配置
 *
 * @author ruoyi
 */
@Component
@ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig
{
    /** 项目名称 */
    private String name;

    /** 版本 */
    private String version;

    /** 版权年份 */
    private String copyrightYear;

    /** 上传路径 */
    private static String profile;

    /** 获取地址开关 */
    private static boolean addressEnabled;



    /** 验证码类型 */
    private static String captchaType;

    /** 微信小程序appid */
    private static String appId;

    /** 小程序设置的api密钥 */
    private static String apiKey;

    /** 微信商户平台 商户id */
    private static String mchId;

    private static String domain;

    /** 短信应用 SDK AppID */
    private static String smsAppId;
    /** 短信应用 SDK AppKey */
    private static String smsAppKey;
    /** 短信模板 ID，需要在短信应用中申请 */
    private static String smsTemplateId;
    /** 下单短信模版ID */
    private static String smsOrderTemplateId;

    /** 签名参数使用的是`签名内容`，而不是`签名ID`*/
    private static String smsSign;
    /** 自定义验证码过期时间 */
    private static String smsTime;

    /** GPS接口调用地址 */
    private static String gpsUrl;

    public static String getGpsUrl() {
        return gpsUrl;
    }

    public void setGpsUrl(String gpsUrl) {
        RuoYiConfig.gpsUrl = gpsUrl;
    }

    public static String getSmsOrderTemplateId() {
        return smsOrderTemplateId;
    }

    public  void setSmsOrderTemplateId(String smsOrderTemplateId) {
        RuoYiConfig.smsOrderTemplateId = smsOrderTemplateId;
    }

    public static String getSmsAppId() {
        return smsAppId;
    }

    public  void setSmsAppId(String smsAppId) {
        RuoYiConfig.smsAppId = smsAppId;
    }

    public static String getSmsAppKey() {
        return smsAppKey;
    }

    public  void setSmsAppKey(String smsAppKey) {
        RuoYiConfig.smsAppKey = smsAppKey;
    }

    public static String getSmsTemplateId() {
        return smsTemplateId;
    }

    public  void setSmsTemplateId(String smsTemplateId) {
        RuoYiConfig.smsTemplateId = smsTemplateId;
    }

    public static String getSmsSign() {
        return smsSign;
    }

    public  void setSmsSign(String smsSign) {
        RuoYiConfig.smsSign = smsSign;
    }

    public static String getSmsTime() {
        return smsTime;
    }

    public  void setSmsTime(String smsTime) {
        RuoYiConfig.smsTime = smsTime;
    }

    public static String getDomain() {
        return domain;
    }

    public  void setDomain(String domain) {
        RuoYiConfig.domain = domain;
    }

    public static String getAppId() {
        return appId;
    }

    public  void setAppId(String appId) {
        RuoYiConfig.appId = appId;
    }

    public static String getApiKey() {
        return apiKey;
    }

    public  void setApiKey(String apiKey) {
        RuoYiConfig.apiKey = apiKey;
    }

    public static String getMchId() {
        return mchId;
    }

    public  void setMchId(String mchId) {
        RuoYiConfig.mchId = mchId;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getVersion()
    {
        return version;
    }

    public void setVersion(String version)
    {
        this.version = version;
    }

    public String getCopyrightYear()
    {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear)
    {
        this.copyrightYear = copyrightYear;
    }

    public static String getProfile()
    {
        return profile;
    }

    public void setProfile(String profile)
    {
        RuoYiConfig.profile = profile;
    }

    public static boolean isAddressEnabled()
    {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled)
    {
        RuoYiConfig.addressEnabled = addressEnabled;
    }

    public static String getCaptchaType() {
        return captchaType;
    }

    public void setCaptchaType(String captchaType) {
        RuoYiConfig.captchaType = captchaType;
    }

    // 注入上传文件空指针问题
//    @Bean(name = "multipartResolver")
//    public MultipartResolver multipartResolver() {
//        return new CommonsMultipartResolver();
//    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath()
    {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath()
    {
        return getProfile() + "/avatar";
    }
    /**
     * 获取车辆图片上传路径
     */
    public static String getVehiclePath()
    {
        return getProfile() + "/vehicle";
    }

    /**
     * 获取评价图片上传路径
     */
    public static String getBussCommPath()
    {
        return getProfile() + "/busscomment";
    }

    /**
     * 获取订单身份证,驾驶证上传路径
     */
    public static String getOrderCertiPath()
    {
        return getProfile() + "/ordercerti";
    }

    /**
     * 获取订单油量里程上传路径
     */
    public static String getFuelMilPath()
    {
        return getProfile() + "/orderfuelmil";
    }


    /**
     * 获取车辆违章图片上传路径
     */
    public static String getVehViolationPath()
    {
        return getProfile() + "/vehviolation";
    }
    /**
     * 获取订单车损上传路径
     */
    public static String getVehDamagePath()
    {
        return getProfile() + "/ordervehdamage";
    }
    /**
     * 获取订单维修发票上传路径
     */
    public static String getVehInvoicePath()
    {
        return getProfile() + "/ordervehinvoice";
    }
    /**
     * 获取工商营业执照图片上传路径
     */
    public static String getBussPicsPath()
    {
        return getProfile() + "/busspics";
    }

    /**
     * 获取用户身份证图片上传路径
     */
    public static String getIdCardPicsPath()
    {
        return getProfile() + "/useridcardpics";
    }

    /**
     * 获取微信用户人脸识别头像上传路径
     */
    public static String getWxuserPath()
    {
        return getProfile() + "/wxuser";
    }

    /**
     * 法人人脸识别头像上传路径
     */
    public static String getFacialRecoPath()
    {
        return getProfile() + "/facialrecopic";
    }
    /**
     * 获取车辆视频上传路径
     */
    public static String getVehVideoPath()
    {
        return getProfile() + "/vehvideo";
    }
    /**
     * 获取微信用户头像上传路径
     */
    public static String getProfileImgPath()
    {
        return getProfile() + "/wxprofileimg";
    }
    /**
     * 获取门店照片上传路径
     */
    public static String getShopPath()
    {
        return getProfile() + "/shop";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath()
    {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }
}
